import request from "@/utils/request";
import { DEFAULT_HEADER } from "../../common";
import { vo, query, form } from './params';
import { AxiosPromise } from 'axios';

// 抽取共用url部分
const baseUrl = "/system/chooseGroup";

const apiList = {
  listQuery: baseUrl + "/list", //查询列表
};

// 详细查询功能
export function getInfo(id: string | number | Array<string | number>) {
  return request({
    url: baseUrl + "/" + id,
    method: "get",
    headers: {
      ...DEFAULT_HEADER,
    },
  });
}

// 列表查询功能
export function listQuery(parameter: query): AxiosPromise<vo[]> {
  return request({
    url: apiList.listQuery,
    method: "get",
    headers: {
      ...DEFAULT_HEADER,
    },
    params: parameter,
  });
}

// 新增功能
export function add(parameter: form) {
  return request({
    url: baseUrl,
    method: "post",
    headers: {
      ...DEFAULT_HEADER,
    },
    data: parameter,
  });
}
// 编辑功能
export function edit(parameter: form) {
  return request({
    url: baseUrl,
    method: "put",
    headers: {
      ...DEFAULT_HEADER,
    },
    data: parameter,
  });
}
// 删除功能
export function del(id: string | number | Array<string | number>) {
  return request({
    url: baseUrl + "/" + id,
    method: "delete",
    headers: {
      ...DEFAULT_HEADER,
    },
  });
}
// 用于下拉选列表查询功能
export function getGroupList() {
  return request({
    url: apiList.listQuery,
    method: "get",
    headers: {
      ...DEFAULT_HEADER,
    },
  });
}
// 批量导入用户 
// export function importExlUser(data:any) {
//   return request({
//     url: apiList.importExlUser,
//     method: "post",
//     headers: {
//       'isBigfileUpload': 'Y',
//       ...DEFAULT_HEADER,
//       'Content-Type': 'multipart/form-data;charset=UTF-8',
//     },
//     data,
//   });
// }
